package net.mhelvens.deltaprofiles;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

public class CoordinatorService extends Service {
	private static final String TAG = CoordinatorService.class.getSimpleName();
	
	public static final String ACTION_INITIALIZE   = "net.mhelvens.deltaprofiles.action.INITIALIZE";
	public static final String ACTION_HANDLE_EVENT = "net.mhelvens.deltaprofiles.action.HANDLE_EVENT";
	
	@Override
	public IBinder onBind(Intent intent) {
		return null;
	}
	
	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		if (intent.getAction().equals(ACTION_INITIALIZE  )) onActionInitialize();
		if (intent.getAction().equals(ACTION_HANDLE_EVENT)) onHandleEvent(intent);
		return super.onStartCommand(intent, flags, startId);
	}
	
	private void onActionInitialize() {
		// The service just started. Check all conditions, set all settings, start all relevant monitors.
		Log.d(TAG, "onActionInitialize'd");
		
		// TODO
	}
	
	private void onHandleEvent(Intent intent) {
		// We just got word from one of our monitoring services. Change status, perform effects.
		
		// TODO
	}
}
